// 把页面给引进来，使用懒加载的方式
// lazy 就是用来懒加载的
import {lazy} from "react"
import {Navigate} from "react-router-dom"
// Navigate 是用于重定向的
// 组件首字母必须大写
const Movie = lazy(()=>import("../page1/Movie"))
const Video = lazy(()=>import("../page1/Video"))
const My = lazy(()=>import("../page1/My"))
const Home  = lazy(()=>import("../page1/Home"))
const ShortVideo = lazy(()=>import("../page1/ShortVideo"))
const Show = lazy(()=>import("../page1/Show"))
const Detail = lazy(()=>import("../page1/Detail"))
const Detail1 = lazy(()=>import("../page1/Detail1"))
const Login = lazy(()=>import("../page1/Login"))
const routerconfig = [
    {
        path:"/my",
        element:<My></My>
    },
    {
        path:"/home",
        element:<Home></Home>,
        children:[
            {
                path:"/home/movie",
                element:<Movie></Movie>
            },
            {
                path:"/home/video",
                element:<Video></Video>
            },
            {
                path:"/home/shortVideo",
                element:<ShortVideo></ShortVideo>
            },
            {
                path:"/home/show",
                element:<Show></Show>
            }
        ]
    },
    // {
    //     path:"/detail/:id", // 这种方式叫动态路由啊
    //     element:<Detail></Detail>
    // },
    {
        path:"/detail1", // 普通的路由跳转
        element:<Detail1></Detail1>
    },
    {
        path:"/",
        element:<Navigate to="/movie"></Navigate>
    },
    {
        path:"/login",
        element:<Login></Login>
    }
]
export default routerconfig
